package com.example.gdeserver.mapper;

import com.example.gdeserver.bean.UserEntity;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

//指定这是操作数据库的mapper
@Mapper
public interface UserMapper {

    //    @Select("select * from u where userid=#{id}")
//    public UserEntity getUserById(String id);
//    @Delete("delete  from u where id=#{id}")
//    public int deleteById(String id);
//    @Insert("insert into userEntity() value (#{userEntity})")
//    public int insertUser(UserEntity userEntity);
//    @Update("update userEntity set userEntity=#{userEntity}")
//    public int update(UserEntity userEntity);
//    @Select("select * from u")
//    public List<UserEntity> getUsers();

    //用户信息
    @Select("select * from u")
    public List<Map<String, Object>> userList();


    //用户经常使用的网站
    @Select("select u,count(u) from u left join d on u.userid=d.id and u <> 'null' and d.u <> 'NULL' and userid=#{userid} group by  u order by count(u) desc;")
    public List<Map<String, Object>> userWebsits(String userid);

    //    用户经常使用的软件
    @Select("select p,count(p) from u left join d on u.userid=d.id  and userid=#{userid} group by  p order by count(p) desc ;")
    public List<Map<String, Object>> userSoftware(String userid);
}
